package com.demo;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import com.demo.gather.GatherImpl;
import com.demo.send.SendImpl;

//客户端程序入口
public class Application {

	public static void main(String[] args) {
		//创建定时器线程池
		ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(5);
		
		//创建采集对象
		GatherImpl getNumber = new GatherImpl();
		SendImpl sendNumber = new SendImpl();
		
		//创建任务并执行
		scheduledThreadPool.scheduleAtFixedRate(new Runnable() {
			
			@Override
			public void run() {
//				System.out.println("测试定时器");
				sendNumber.send(getNumber.gather());
				
			}
		}, 1, 600, TimeUnit.SECONDS);
	}

}
